home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- * Copyright (c) 1989-1992 Stone Design Corp. All rights reserved.
- * programmer: Bill Bumgarner
- * File name: SD_Texture.sl
- * Date: Jul 21 1992
- * Purpose: The simplest of textures w/lighting cues...
-
- Variables:
- txmap: full path to the texture map file
-
- Ka: percentage of ambient light used
- Kd: percentage of diffuse light used
- Ks: specular highlight intensity
- roughness: the roughness/smoothness (reflectivity) of
- of the surface-- very noticeable effect on the
- specular highlight
- specularcolor: color used in the specular highlight
- ***************************************************************************/
-
- surface SD_Texture(
- string txmap = "";
-
- float Ka = 1,
- Kd = .5,
- Ks = .5,
- roughness = .1;
- color specularcolor = 1;
- )
- {
- point Nf = faceforward(N, I);
-
-
- if(txmap != ""){
- Ci = color texture(txmap, s, t);
- } else {
- Ci = Cs;
- }
- Oi = Os;
- Ci=Os * (Ci * (Ka*ambient() + Kd*diffuse(Nf)) +
- specularcolor * Ks * specular(Nf,-I,roughness));
- }